<template>
	<!--
    	作者：1550495493@qq.com
    	时间：2019-08-13
    	描述：项目管理员-项目管理
    -->
	<div class="Announcements">
		<div class="Website-visits">
			<div class="location">
				<div class="location-text fl">
					<img class="location-img fl" src="../../images/ProjectManager/baseProject.png" />
					<p class="fr">项目管理</p>
				</div>
				<img class="biaotibg fl" src="../../images/home/biaotibg.png" />
			</div>
			<div class="search-box">
				<div class="fl">
					<input name="search" class="search" type="text" autocomplete="off" v-model="search" />
					<input class="btn" type="button" value="搜索" @click="searchTodo" />
				</div>
				<div class="fr">
					<div @click="openModal()" class="user-box user-name">新增项目需求</div>
				</div>
			</div>
			<div class="PressRelease-list">
				<table>
					<thead>
						<tr>
							<th class="table-text-th2">项目名称</th>
							<th class="table-text-th2">发布基地</th>
							<th class="table-text-th1">项目类型</th>
							<th class="table-text-th1">合同开始时间</th>
							<th class="table-text-th1">合同结束时间</th>
							<th class="table-text-th1">项目详情</th>
							<th class="table-text-th1">项目总金额</th>
							<th class="table-text-th1">到账情况</th>
							<th class="table-text-th1">项目动态</th>
							<th class="table-text-th1">对接专家</th>
							<th class="table-text-th1">项目状态</th>
							<th class="table-text-th2">操作</th>
						</tr>
					</thead>
					<tbody>
						<tr v-if="projectList.length == 0">
							<td colspan="12" class="center">暂无数据！</td>
						</tr>
						<tr v-for="(project,index) in projectList"  :class="index==curIndex?'activeBg':''" @click="choosed(index)">
							<td :title="project.name"><span class="show-oneline-table">{{project.name}}</span></td>
							<td :title="project.areasName"><span class="show-oneline-table">{{project.areasName}}</span></td>
							<td>{{project.type == 1 ? "横向项目" : "研究院项目"}}</td>
							<td>{{formatData(project.contractBeginTime)}}</td>
							<td>{{formatData(project.contractEndTime)}}</td>
							<td><input @click="projectDetails(project.id)" type="button" value="查看" class="delete write" /></td>
              <td><template v-if="project.initiationAuditStatus == 2">{{project.budgetAmount}}</template></td>
							<td>
                <template v-if="project.initiationAuditStatus == 2">
                  {{project.accountStatus == 1 ? "已到账" : "未到账"}}
                </template>
              </td>
							<td><input @click="projectDynamic(project)" type="button" value="查看" class="delete write" /></td>
							<td><input @click="projectExpert(project)" type="button" value="查看" class="delete write" /></td>
							<td>
								<!-- 发布状态-->
								<template v-if="project.releaseStatus == 1">
									<!--项目进度状态-->
									<!--项目筛选-->
									<template v-if="project.processStatus == 0">
										<template v-if="project.screenAuditStatus == 1">
											待筛选
										</template>
										<template v-else-if="project.screenAuditStatus == 2">
											<!--筛选成功-->待立项
										</template>
										<template v-else-if="project.screenAuditStatus == 3">
											筛选失败
										</template>
									</template>
									<template v-else-if="project.processStatus == 1">
										待立项
									</template>
									<!--项目立项-->
									<template v-else-if="project.processStatus == 2">
                    待立项
                    <!--<template v-if="project.initiationAuditStatus == 1">
											&lt;!&ndash;待审核&ndash;&gt;待立项
										</template>
										<template v-if="project.initiationAuditStatus == 2">
                      <template v-if="project.accountingStatus == 1">
                        通过
                      </template>
                      <template v-else>
                        待立项
                      </template>
										</template>
										<template v-if="project.initiationAuditStatus == 3">
											不通过
										</template>-->
									</template>
									<!--项目中期-->
									<template v-else-if="project.processStatus == 3">
                    项目中期
                    <!--<template v-if="project.metaphaseAuditStatus == 1">
											待审核
										</template>
										<template v-if="project.metaphaseAuditStatus == 2">
											&lt;!&ndash;中期通过&ndash;&gt;通过
										</template>
										<template v-if="project.metaphaseAuditStatus == 3">
											不通过
										</template>-->
									</template>
									<!--项目结题-->
									<template v-else-if="project.processStatus == 4">
										<template v-if="project.closureAuditStatus == 1">
											<!--待审核-->项目结题
										</template>
										<template v-if="project.closureAuditStatus == 2">
											<!--通过-->结题成功
										</template>
										<template v-if="project.closureAuditStatus == 3">
											<!--不通过-->结题失败
										</template>
										<template v-if="project.closureAuditStatus == 4">
											限期整改
										</template>
									</template>
								</template>
								<template v-else-if="project.releaseStatus == 0 && project.fromStatus == 1">
									待发布
								</template>
							</td>
							<td>
                <input @click="projectRelease(project.id)" type="button" value="发布" class="delete write" v-if="project.releaseStatus == 0"/>
                <input @click="openModal(project.id)" type="button" value="修改" class="delete write" v-if="project.releaseStatus == 0"/>
                <input @click="deleteProject(project.id)" type="button" value="删除" class="delete write" v-if="project.releaseStatus == 0"/>
							</td>
						</tr>
					</tbody>
				</table>

			</div>
			<!--total  数据总数   size  一页多少条数据   page  当前页码    changge 返回当前选择的页码  改变一页显示条 child  返回值就是一页显示条数  -->
			<pageination :total="total" :size="size" :page="page" :changge="pageFn" @child="obtainChild"></pageination>
		</div>
		<!-- 新增项目需求-模态框-->
		<div v-show="modelShow" class="tenant-model add-need-model">
			<div class="tenant-model-content">
				<header class="tenant-model-header">
					<p v-if="!project.id">新增项目需求</p>
					<p v-if="project.id">修改项目需求</p>
					<span @click="closeModel" class="closeModel">×</span>
				</header>
				<div class="tenant-model-body add-project-need">
					<div class="search-contain">
						<!--模态框内容板块-->
						<form class="form-box add-project" id="projectForm">
							<input type="hidden" name="id" v-model="project.id" />
							<div class="after">
								<div class="form-line fl">
									<label>基地名称：</label>
									<select name="areasId">
					                    <option value="-1">请选择</option>
					                    <option v-for="areas in areasList" :value="areas.id" :selected="areas.id == project.areasId ? true : false">{{areas.name}}</option>
					                </select>
								</div>
								<div class="form-line fr">
									<label><span class="star">*</span>项目类型：</label>
									<select name="type">
				                      <option value="">请选择</option>
				                      <option value="1" :selected="project.type == 1 ? true : false">横向项目</option>
				                      <option value="0" :selected="project.type == 0 ? true : false">研究院项目</option>
				                    </select>
								</div>
							</div>
							<div class="form-line">
								<label><span class="star">*</span>项目名称：</label>
								<div class="input-box">
									<input type="text" name="name" v-model="project.name"  class="project-name">
								</div>
							</div>
							<div class="introduce">
								<label class="textarea-label">&nbsp;<span class="star">*</span>项目简介：</label>
								<textarea name="introduction" class="input-box textarea-box" v-model="project.introduction"></textarea>
							</div>
							<div class="form-line need-template">
								项目需求说明书模板：<span @click="download()" class="delete write">下载</span>
							</div>
							<div class="search-boxs">
								<label>&nbsp;&nbsp;<span class="star">*</span>附件上传：</label>
								<input type="hidden" name="demandBookUrl" v-model="project.demandBookUrl" />
								<input type="file" id="handIdFront" accept=".txt,.rar,.zip,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.exe,image/*" @change="idFrontImg($event)" style="display: none;" />
								<input type="button" value="上传附件" class="delete write" @click="touchOffIdInput(1)"/>
								<input type="button" value="删除附件" class="delete write" @click="deleteEnclosure()"  v-if="uploadFileList.length"/>
								<ul class="img-box add-model-upload" v-if="uploadFileList.length">
									<li v-for="file in uploadFileList">{{file}}</li>
								</ul>
							</div>
							<input type="reset" style="display: none" />
						</form>
					</div>
					<div class="tenant-model-footer add-model-footer">
						<button class="determine" @click="saveProject" v-if="project.id == null">创建项目</button>
						<button class="determine" @click="updateProject" v-else>保存</button>
					</div>
				</div>
			</div>

		</div>
	<!-- 项目详情-模态框-->
	<div v-if="projectDetailsModelShow" class="tenant-model projectDetailsModelShow">
		<div class="tenant-model-content">
			<header class="tenant-model-header">
				<h3>查看项目详情</h3>
				<span @click="closeModel" class="closeModel">×</span>
			</header>
			<div class="tenant-model-body">
				<div class="search-contain">
					<!--模态框内容板块-->
					<div class="rork">
						<div>基地名称：<p>{{project.areasName}}</p></div>
						<div>项目名称：<p>{{project.name}}</p></div>
						<div>项目类型：{{project.type == 1 ? "横向项目" : "研究院项目"}}</div>
						<div>项目简介：<p>{{project.introduction}}</p></div>
						<div>项目需求说明书：
              <input @click="preview(project.demandBookUrl)" type="button" value="预览" class="delete write"/>
            </div>
					</div>
				</div>
			</div>
			<!--<footer class="tenant-model-footer">
          <button class="determine" @click="closeModel">返回</button>
        </footer>-->
		</div>
	</div>
	<!-- 项目动态-模态框-->
	<div v-if="projectDynamicModelShow" class="tenant-model">
		<div class="tenant-model-content demandModel">
			<header class="tenant-model-header">
				<h3>查看项目动态</h3>
				<span @click="closeModel" class="closeModel">×</span>
			</header>
			<div class="tenant-model-body">
				<div class="search-contain">
					<!--模态框内容板块-->
					<div class="tab-tit">
						<a href="javascript:;" @click="curId=0" :class="{'cur':curId===0}">项目立项</a>
						<a href="javascript:;" @click="curId=1" :class="{'cur':curId===1}">项目中期</a>
						<a href="javascript:;" @click="curId=2" :class="{'cur':curId===2}">项目结题</a>
					</div>
					<div class="tab-con">
						<div v-show="curId===0">
							<p class="rork-text">专家任务书</p>
							<div class="rork">
								<div>项目名称：<p>{{project.name}}</p></div>
				                <p>起时间：{{formatData(project.contractBeginTime)}}</p>
				                <p>止时间：{{formatData(project.contractEndTime)}}</p>
				                <p>项目负责人：{{project.expertName}}</p>
				                <p>身份证号：{{project.expertIDCard}}</p>
				                <p>项目总金额：<template v-if="project.initiationAuditStatus == 2">{{project.budgetAmount}}</template></p>
												<p>任务书附件：
				                  <input @click="preview(project.taskBookUrl)" type="button" value="预览" class="delete write" v-if="project.initiationAuditStatus == 2"/>
				                </p>
							</div>
						</div>
						<div v-show="curId===1">
							<p class="rork-text">中期进度报告</p>
							<div class="rork">
								<div>项目名称：<p>{{project.name}}</p></div>
								<p>起时间：{{formatData(project.contractBeginTime)}}</p>
								<p>止时间：{{formatData(project.contractEndTime)}}</p>
                <p>项目负责人：{{project.expertName}}</p>
								<p>身份证号：{{project.expertIDCard}}</p>
                <p>项目总金额：<template v-if="project.initiationAuditStatus == 2">{{project.budgetAmount}}</template></p>
                <p>经费使用金额：<template v-if="project.metaphaseAuditStatus == 2">{{project.practicalAmount}}</template></p>
								<p>中期报告附件：
                  <input @click="preview(project.metaphaseReportUrl)" type="button" value="预览" class="delete write" v-if="project.metaphaseAuditStatus == 2"/>
                </p>
							</div>
						</div>
						<div v-show="curId===2">
							<p class="rork-text">结题报告</p>
							<div class="rork">
								<div>项目名称：<p>{{project.name}}</p></div>
								<p>起时间：{{formatData(project.contractBeginTime)}}</p>
								<p>止时间：{{formatData(project.contractEndTime)}}</p>
								<p>项目负责人：{{project.expertName}}</p>
								<p>身份证号：{{project.expertIDCard}}</p>
                <p>项目总金额：<template v-if="project.initiationAuditStatus == 2">{{project.budgetAmount}}</template></p>
                <p>经费使用金额：<template v-if="project.closureAuditStatus == 2">{{project.closurePracticalAmount}}</template></p>
								<p>结题报告附件：
                  <input @click="preview(project.closureMaterialUrl)" type="button" value="预览" class="delete write" v-if="project.closureAuditStatus == 2"/>
                </p>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- 对接专家-模态框-->
	<div v-if="projectExpertModelShow" class="tenant-model">
		<div class="tenant-model-content demandModel">
			<header class="tenant-model-header">
				<h3>查看对接专家</h3>
				<span @click="closeModel" class="closeModel">×</span>
			</header>
			<div class="tenant-model-body">
				<div class="search-contain">
					<!--模态框内容板块-->
					<table>
						<tr>
							<th>专家姓名</th>
							<th>身份证号</th>
							<th>二级学科</th>
							<th>合作次数</th>
							<th>工作记录</th>
							<th>联系方式</th>
						</tr>
						<tr v-if="project.expertIDCard == null || project.expertIDCard == ''">
							<td colspan="6" class="center">暂无数据！</td>
						</tr>
						<tr v-else>
							<td>{{project.expertName}}</td>
							<td>{{project.expertIDCard}}</td>
							<td>{{project.expertSecondLevel}}</td>
							<td>
                {{project.already}}|{{project.guide}}
              </td>
							<td><input @click="rorkRecord(project.id,project.expertId)" type="button" value="查看" class="delete write"/></td>
							<td>{{project.expertPhone}}</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
	</div>
	<!-- 工作记录-模态框-->
	<div v-if="workModelShow" class="tenant-model">
		<div class="tenant-model-content">
			<header class="tenant-model-header">
				<h3>查看工作记录</h3>
				<span @click="closeWorkModel" class="closeModel">×</span>
			</header>
			<div class="tenant-model-body secondLevelPageination">
				<div class="search-contain look-work-record">
					<!--模态框内容板块-->
					<!--<div class="rork-ecord center" v-if="expertWorkLogList == null || expertWorkLogList.length == 0">
						暂无数据！
					</div>
					<div class="rork-ecord" v-for="expertWorkLog in expertWorkLogList">
						<p>时间：{{formatData(expertWorkLog.createAt)}}</p>
						&lt;!&ndash;<p>履职内容：{{expertWorkLog.theme}} </p>&ndash;&gt;
						<div>地点：
							<div class="situation-two">{{expertWorkLog.position}}</div>
						</div>
						<div>事由：
							<div class="situation-two">{{expertWorkLog.content}}</div>
						</div>
						<p>图片：<img :src="expertWorkLog.picture" v-if="expertWorkLog.picture != null && expertWorkLog.picture != null" /></p>
					</div>-->
          <table>
            <tr>
              <th class="w100">时间</th>
              <th class="w200">事由</th>
              <th class="w200">地点</th>
              <th class="w80">附件</th>
            </tr>
            <tr v-if="expertWorkLogList.length == 0">
              <td colspan="4" class="center">暂无数据！</td>
            </tr>
            <tr v-for="expertWorkLog in expertWorkLogList">
              <td>{{formatData(expertWorkLog.beginTime)}}</td>
              <td :title="expertWorkLog.content"><span class="show-oneline-table">{{expertWorkLog.content}}</span></td>
              <td :title="expertWorkLog.position"><span class="show-oneline-table">{{expertWorkLog.position}}</span></td>
              <td>
              	<button @click="preview2(expertWorkLog.picture)" class="delete write">预览</button>
              </td>
            </tr>
          </table>
          <pageination :total="workLogTotal" :size="workLogSize" :page="workLogPage" :changge="workLogPageFn"></pageination>
				</div>
			</div>
		</div>
	</div>
	</div>

</template>
<script src="./projectManagement.js"></script>

<style scoped>
	@import "projectManagement.css"
</style>
